package com.yanglei.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * consul的消费者
 */
@RestController
@Slf4j
public class OrderConsulController {

    public static final String ORDER_CONSUL_NAME = "http://consul-provider-payment8006";
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/orderConsul")
    public String orderConsul80() {
        String res = restTemplate.getForObject(ORDER_CONSUL_NAME + "/test8006", String.class);
        return res;
    }
}
